﻿using System.Collections;
using System.Collections.Generic;

namespace MikeKappel.Com.CS
{
    public static partial class Helper
    {
        /// <summary>
        /// Using Generics to retrun a Strongly Typed List
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <returns></returns>
        public static List<T> ToListOf<T>(IList list)
        {
            if (list == null) return null;
            ArrayList TempList = new ArrayList(list);
            return new List<T>(TempList.ToArray(typeof(T)) as T[]);
        }
    }
}